/**
 * home 小仓库大曹哭
 */

import {computed, ref} from "vue";
// 引入 pinia 创建小仓库的方法
import {defineStore} from "pinia";

// 获取得到 home 小仓库的方法，并对外分别暴露
export const useHomeStore = defineStore("home", () => {
    // state
    const count = ref<number>(0);

    // getter
    const computedCount = computed(() => {
        return count.value + 1;
    });

    // action
    function increment() {
        count.value++;
    }

    // 将 state, action, getter 对外暴露
    return {count, increment, computedCount};
});



